package com.usf.jprovider.schema.provider.random.string;

import com.usf.jprovider.object.JObjectNode;
import com.usf.jprovider.object.env.Environment;
import com.usf.jprovider.object.type.JString;
import com.usf.jprovider.object.type.JType;
import com.usf.jprovider.tools.RandomTools;

public final class NumericStringRandom extends AbstractStringRandomProvider{

	public NumericStringRandom() {
		super();
	}
	
	@Override
	public JString create(Environment env, JObjectNode node) {
		int count = RandomTools.randomizeInteger(min, max);
		return new JString(RandomTools.randomizeNumericString(count));
	}
	@Override
	public boolean checkValue(Environment env, JObjectNode node, JType<?> value){
		int count = value.toString().length();
		return (count >= min && count <= max);
	}
}
